package com.yunji.order.service;

import com.yunji.order.bo.OrderScaleBO;
import com.yunji.order.context.convert.TradeConvert;
import com.yunji.order.dao.IOrderScaleDao;
import com.yunji.order.domain.OrderScaleDO;
import com.yunji.order.dto.OrderScaleParam;
import com.yunji.order.vo.OrderScaleVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.order.service.impl
 * @Title: ScaleServiceImpl
 * @Description: 分润接口实现
 * History:
 * Date						Version			Author			Summary
 * ========================================================================
 * 2024-04-27 19:55:28		V1.0			HuaAo		新建类
 */
@Service
public class OrderScaleService {
    @Resource
    private IOrderScaleDao scaleDao;

    public OrderScaleDO getSaleById(Long scaleId) {
        return scaleDao.getById(scaleId);
    }

    public boolean createScale(OrderScaleDO scale) {
        return scaleDao.save(scale);
    }

    public boolean createScales(List<OrderScaleDO> scales) {
        return scaleDao.saveBatch(scales);
    }

    public List<OrderScaleDO> getOrderScaleList(OrderScaleBO param) {
        return scaleDao.getOrderScaleList(param);
    }

    public List<OrderScaleVO> scaleList(OrderScaleParam param) {
        List<OrderScaleVO> orderScaleVOS = scaleDao.orderScaleVOList(param);
        TradeConvert.convertOrderScaleVOs(orderScaleVOS);
        return orderScaleVOS;
    }
}